package com.jydd.singlekotlinmvvm.comm.helpers

import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager

/**
 * created by 韦敏敏
 * on 2020/1/20
 */
abstract class LoadMoreRecyclerviewScrollListener : EndlessRecyclerViewScrollListener {
    var hasMoreToLoad = true
    override fun onLoadMore(page: Int, totalItemsCount: Int, view: RecyclerView) {
        if (hasMoreToLoad) fetchMore()
    }
    constructor(layoutManager: LinearLayoutManager) : super(layoutManager)
    constructor(layoutManager: GridLayoutManager) : super(layoutManager)
    constructor(layoutManager: StaggeredGridLayoutManager) : super(layoutManager)
    abstract fun fetchMore()
}